package cn.kgc.vue.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author 课工场
 * @date 2024/9/20
 * @description   跨域的全局处理方案
 */
@Configuration
public class GlobalCrossConfig implements WebMvcConfigurer {

    @Override
    public void addCorsMappings(CorsRegistry registry) {

        registry.addMapping("/**")
                .allowedHeaders("*")
                .allowedMethods("*")  //  get  post
                .allowedOrigins("*");  //  允许所有的请求源
    }
}
